$(function () {
    speclialTitle();
    function speclialTitle() {
        $.ajax({
            url: 'http://193.112.55.79:9090/api/getcategorytitle',
            type: 'get',
            dataType: 'json',
            success: function (res) {
                // console.log(res)
                var htmlStr = template('speclial_Tmp', res);
                $('#accordion').html(htmlStr);

                $.each($('#accordion a'),function(index,data){
                      var that=data;
                      titleId=$(that).data('titleid');
                      $.ajax({
                          url:'http://193.112.55.79:9090/api/getcategory?titleid='+titleId,
                          type:'get',
                          dataType:'json',
                          success:function(res){
                              var htmlStr = template('speclial_ListTmp',res);
                              var $don=$(that).parent().parent();
                              $don.next().find('.row').html(htmlStr);
                          }
                      })
                })
            }
        })
    }
   
    function speclialClick(){
        $('#accordion a').on('click', function (e) {
            var titleId = $(this).data('titleid');
            var that=this;
            $.ajax({
                url: 'http://193.112.55.79:9090/api/getcategory?titleid='+titleId,
                type: 'get',
                dataType: 'json',
                success: function (res) {
                    console.log(res);
                    var htmlStr = template('speclial_ListTmp',res);
                    var $dom=$(that).parent().parent();
                   $dom.next().find('.row').html(htmlStr);
                }
            })
        })
    }
})
